package com.retail.proxy.service.impl;


import com.retail.proxy.entity.vo.ProxyMechanismGroomVo;
import com.retail.core.entity.ParamReq;
import com.retail.proxy.entity.request.ProxyMechanismGroomRequest;
import com.retail.proxy.mapper.ProxyMechanismGroomMapper;
import com.retail.proxy.service.ProxyMechanismGroomService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

/**
* 推荐奖励 Service impl
* @author Administrator
*/
@Service
public class ProxyMechanismGroomServiceImpl implements ProxyMechanismGroomService {

   @Resource
   private ProxyMechanismGroomMapper proxyMechanismGroomMapper;

   @Override
   public ProxyMechanismGroomVo getModel(Long id) {
      return  proxyMechanismGroomMapper.getModel(id);
   }

   @Transactional
   @Override
   public Long save(ProxyMechanismGroomRequest proxyMechanismGroomRequest) {
      proxyMechanismGroomMapper.save(proxyMechanismGroomRequest);
      return proxyMechanismGroomRequest.getId();
   }

   @Transactional
   @Override
   public Long update(ProxyMechanismGroomRequest proxyMechanismGroomRequest) {
      proxyMechanismGroomMapper.update(proxyMechanismGroomRequest);
      return proxyMechanismGroomRequest.getId();
   }

   @Override
   public List<ProxyMechanismGroomVo> listPage(ParamReq<ProxyMechanismGroomRequest> params) {
      params.setStartIndex((params.getCurrent() -1 ) * params.getSize());
      return proxyMechanismGroomMapper.listPage(params);
   }

   @Override
   public Integer countPage(ParamReq<ProxyMechanismGroomRequest> params) {
       return proxyMechanismGroomMapper.countPage(params);
   }

   @Override
   public Integer updateDelFlagById(Long id, Integer delFlag) {
       return proxyMechanismGroomMapper.updateDelFlagById(id, delFlag);
   }
}
